<?php

class page_ini {
    
    public $code = 'page';
    public $title = 'Страница';
    public $description = 'Модуль для создание статичных страниц.';
    public $author = 'Ладыгин Сергей';
    public $email  = 'webcoderu@gmail.com';
    public $site   = 'www.coolweb.su';
    public $update = 'www.coolweb.su';
    public $admin  = true;
    public $is_install = false;
    
    public $methods = array('index' => 'Текстовая страница');
    public $tools   = array();
    public $widgets = array();
    public $parametrs = array();
    
    public function __construct() {
        
        $this->widgets['block'] = array(
            'title'     => 'Текстовый блок',
            'parametrs' => array(
                'uri'   => array('Материал', 'select', 'callback_pages')
            ),
            'validation' => array(
                'uri'   => 'trim|required|xss_clean'
            )
        );
        
        $this->parametrs['index'] = array(
            'parametrs' => array(
                'uri'   => array('Показать запись', 'select', 'callback_pages')
            ),
            'validation'=> array(
                'uri'   => 'trim|required|xss_clean'
            )
        );
    }
    
    public function callback_pages() {
        
        $CI = &get_instance();
        $result = array();
        
        foreach($CI->db->get('modul_page')->result_array() as $row) {
            
            $result[$row['pag_uri']] = $row['pag_title'];
        }
        
        return $result;
    }
}